import request from '../request'
import type { ApiResponse, PaginationParams, PaginationResponse } from '../types'

export interface Complain {
  id: number
  tenantId: number
  userId: number
  type: number
  contact: string
  content: string
  images: string[]
  status: number
  handlerId: number
  remark: string
}

// 获取投诉列表
export const getComplainList = (params?: PaginationParams) => {
  return request.post<ApiResponse<PaginationResponse<Complain>>>('/admin/app/complain/page', params)
}

// 获取投诉详情
export const getComplainInfo = (id: number) => {
  return request.get<ApiResponse<Complain>>('/admin/app/complain/info', { params: { id } })
}

// 添加投诉
export const addComplain = (data: Omit<Complain, 'id' | 'tenantId' | 'userId' | 'status' | 'handlerId'>) => {
  return request.post<ApiResponse>('/admin/app/complain/add', data)
}

// 更新投诉
export const updateComplain = (data: Partial<Complain>) => {
  return request.post<ApiResponse>('/admin/app/complain/update', data)
}

// 删除投诉
export const deleteComplain = (id: number) => {
  return request.post<ApiResponse>('/admin/app/complain/delete', { id })
} 